package cn.hahah.module.blog.dal.mysql.usercollect;

import java.util.*;

import cn.hahah.framework.common.pojo.PageResult;
import cn.hahah.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.hahah.framework.mybatis.core.mapper.BaseMapperX;
import cn.hahah.module.blog.dal.dataobject.usercollect.UserCollectDO;
import org.apache.ibatis.annotations.Mapper;
import cn.hahah.module.blog.controller.admin.usercollect.vo.*;

/**
 * 用户收藏 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UserCollectMapper extends BaseMapperX<UserCollectDO> {

    default PageResult<UserCollectDO> selectPage(UserCollectPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserCollectDO>()
                .eqIfPresent(UserCollectDO::getId, reqVO.getId())
                .eqIfPresent(UserCollectDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserCollectDO::getArticleId, reqVO.getArticleId())
                .betweenIfPresent(UserCollectDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserCollectDO::getId));
    }

}